using ExampleWebApplication.Entities;
using NHibernate.Mapping.ByCode.Conformist;

namespace ExampleWebApplication.Infraestruture.NHibernate.EntityMappings
{
    public class EmployeeTerritoryMap : ClassMapping<EmployeeTerritory>
    {
        public EmployeeTerritoryMap()
        {
            Table("EmployeeTerritories");
            ComposedId(x =>
            {
                x.Property(c => c.EmployeeID, map => map.Column("EmployeeID"));
                x.Property(c => c.TerritoryID, map => map.Column("TerritoryID"));
            });
            ManyToOne(x => x.Employee, map => map.Column("EmployeeID"));
            ManyToOne(x => x.Territory, map => map.Column("TerritoryID"));
        }
    }
}
